﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;

namespace GDI_AnalysisComponents
{
    public class MoveGComponent
    {
        private float difX;
        private float difY;

        public MoveGComponent()
        {
        }

        public void LButtonDown(Graphics g, PointF mousePt, GComponent gc)
        {
            difX = mousePt.X - gc.X;
            difY = mousePt.Y - gc.Y;
        }

        public void LButtonDown(Graphics g, PointF mousePt, ArrayList gcSels)
        {
            if (gcSels.Count >= 1)
            {
                GComponent gc = (GComponent)gcSels[0];
                difX = mousePt.X - gc.X;
                difY = mousePt.Y - gc.Y;
            }
        }


        public void MouseMove(Graphics g, PointF mousePt, GComponent gc)
        {
            PointF movePt = new PointF(mousePt.X - difX, mousePt.Y - difY);
            gc.MoveToPointF(movePt);
        }

        public void MouseMove(Graphics g, PointF mousePt, ArrayList gcSels)
        {
            PointF movePt = new PointF(mousePt.X - difX, mousePt.Y - difY);
            if (gcSels.Count >= 1)
            {
                GComponent gc = (GComponent)gcSels[0];
                gc.MoveToPointF(movePt);
            }
        }

        public void MouseUp(Graphics g, PointF mousePt, ArrayList gcSavs, ArrayList gcSels)
        {
            difX = 0;
            difY = 0;
        }

    }
}
